package com.thread.test09.hw1;

/**
 * @author bin
 * @date 2025 - 03 -11
 **/
public class MyThread extends Thread{
    @Override
    public void run() {
        while(true){
            Boolean flag = Thread.currentThread().isInterrupted();
            System.out.println("非阻塞线程的中断线程" + flag);
            if(flag){
                break;
            }
            try {
                Thread.sleep(2000);
            }
            catch (Exception e){
                System.out.println("睡眠被中断的状态" + Thread.currentThread().isInterrupted());
                Thread.currentThread().interrupt();
            }
        }
    }
}
